package com.archstoday.activity;

import android.os.Bundle;
import android.widget.TextView;

import com.archstoday.R;
import com.archstoday.adapter.MessageAdapter;
import com.archstoday.view.PullToRefreshLayout;
import com.xw.repo.refresh.PullListView;

/**
 * 消息页面
 */
public class MessageActivity extends AsScrollBaseActivity implements PullToRefreshLayout.OnRefreshListener {

    private TextView mTitleTv;
    private PullToRefreshLayout mPullLayout;
    private PullListView mPullList;

    private MessageAdapter mAdapter;

    @Override
    protected void initView(Bundle bundle) {
        setContentView(R.layout.activity_list);
        mTitleTv = (TextView) findViewById(R.id.title_tv);
        mPullLayout = (PullToRefreshLayout) findViewById(R.id.pull_layout);
        mPullList = (PullListView) findViewById(R.id.pull_list);
        mPullLayout.setOnRefreshListener(this);
    }

    @Override
    protected void initData(Bundle bundle) {
        mTitleTv.setText(R.string.user_message);

        mAdapter = new MessageAdapter(mContext);
        mPullList.setAdapter(mAdapter);
        mAdapter.notifyDataSetChanged();
    }

    @Override
    protected void initListener() {
        setOnClickListener(R.id.back_btn);
    }

    @Override
    public void treatClickEvent(int id) {
        switch (id) {
            case R.id.back_btn:
                appFinish();
                break;
        }
    }

    @Override
    public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {

    }

    @Override
    public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {

    }
}